using System;
using System.Drawing;
using System.Windows.Forms;

public class ImagesButton:Control
{
	private Image[]	img;
	private int		numimages;
	private int		actualimage;

	public ImagesButton (int NumberOfImages):base()
	{
		this.numimages = NumberOfImages;
		img = new Image[this.numimages];
	}
	public int Image
	{
		get{return actualimage;}
		set
		{
			this.actualimage = value;
			Invalidate();
		}
	}
	public void SetImage (int num, Image image)
	{
		if (num<numimages)
			img[num] = image;
	}

	protected override void OnMouseDown(MouseEventArgs e)
	{
		this.actualimage++;
		if (this.actualimage>=this.numimages)
			this.actualimage=0;
		base.OnMouseDown (e);
		this.Invalidate();
	}


	protected override void OnPaintBackground(PaintEventArgs e)
	{
		e.Graphics.DrawImage(this.img[this.actualimage],0,0);
	}
}

 